package com.ygj.employeeReport.service.phenomenon.impl;

import com.base.common.ConfigConstants;
import com.base.common.enums.TicketCategories;
import com.base.common.persistent.dao.TicketMapper;
import com.base.common.persistent.model.Ticket;
import com.ygj.employeeReport.service.base.impl.TicketBaseServiceImpl;
import com.ygj.employeeReport.service.phenomenon.PhenomenonService;
import com.ygj.ticketManage.service.TicketManageService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service("phenomenonService")
public class PhenomenonServiceImpl extends TicketBaseServiceImpl implements PhenomenonService{

	@Resource
	private TicketManageService ticketManageService;
	
	@Resource
	private TicketMapper ticketMapper;
	
	@Override
	public int distributeTickets(String code, List<String> distributeInfoList) {
		String[] ticketIdArr = new String[]{ticketMapper.queryTicketByCode(code.trim()).getId()+""};
		return ticketManageService.distributeTickets(ticketIdArr, distributeInfoList);
	}

	@Override
	public List<Ticket> getPhenomenonByEmployeeId(int employeeId, int page) {
		return ticketMapper.queryTicketsByCategoriesAndEmployeeId(getStartNum(page), Integer.parseInt(ConfigConstants.INFOS_LIST_NUM), TicketCategories.PHENOMENON.getValue(), employeeId);
	}
	
	/*public static void main(String[] args) {
		Date date = new Date(1421830018 / 1000 /60);
		System.out.println(date);
	}*/

}
